package root.loan;

import exceptions.HasAlreadyDoneException;
import exceptions.LoanHasAlreadyBeenApprovedException;
import exceptions.PermissionDeniedException;

/**
 * 
 * State em que o emprestimo eh cancelado
 *
 */
public class Canceled extends State {

	private final String descricao = "Cancelado";
	
	@Override
	public String getDescricao() {
		return descricao;
	}
	
	@Override
	public void returnItem(Borrow borrow) throws HasAlreadyDoneException {
		mudaEstado(borrow,new CanceledReturned());
	}

	@Override
	public void requestDevolution(Borrow borrow) throws HasAlreadyDoneException {
		throw new HasAlreadyDoneException("Devolução já requisitada");
	}
	
	@Override
	public void cancel(Borrow borrow) throws HasAlreadyDoneException {
		throw new HasAlreadyDoneException("Devolução já requisitada");
	}
	
	@Override
	public void aproveBorrow(Borrow borrow) throws LoanHasAlreadyBeenApprovedException ,PermissionDeniedException{
		throw new LoanHasAlreadyBeenApprovedException("Empréstimo já aprovado");
	}
	@Override
	public void complete(Borrow borrow) throws HasAlreadyDoneException ,PermissionDeniedException{
		throw new PermissionDeniedException("Item não retornado");
	}
}